﻿#include "InsertTableThread.h"
#include"FindFund.h"
#include<QDebug>
#include<QStandardItemModel>
InsertTableThread::InsertTableThread(FindFund* FindFund, QStandardItemModel* m_Table_model, QObject* parent)
	:m_FindFund(FindFund),
	m_Table_model(m_Table_model),
	QThread(parent)
{
	if (m_Table_model == nullptr)
	{
		qWarning() << "Table_model指针nullptr";
		delete this;
	}
}

void InsertTableThread::run()
{
	int nSel = 0;
	for (auto& data : m_FindFund->FundForm())
	{
		m_Table_model->setItem(nSel, 0, new QStandardItem(data.second.name));
		m_Table_model->setItem(nSel, 1, new QStandardItem(data.second.code));
		m_Table_model->setItem(nSel, 2, new QStandardItem(data.second.type));
		++nSel;
	}
	qInfo() << "结束了";
}
